package com.klangner.go.ab.moveselector;

import java.util.Collection;

import com.klangner.go.model.IBoard;
import com.klangner.go.model.Move;
import com.klangner.go.model.impl.AtariGoRules;
import com.klangner.go.model.impl.GoBoard;

import junit.framework.TestCase;

public class AllMoveSelectorTest extends TestCase {

	/**
	 * simply case
	 */
	public void testOneStone() {
		IBoard board = new GoBoard(9);
		AllMoveSelector moveSelector = new AllMoveSelector(new AtariGoRules());
		Collection<Move>	moves;
		
		board.setStone(1, 1, IBoard.BLACK_STONE);
		moves = moveSelector.getCandidates(board, IBoard.BLACK_STONE);
		
		assertEquals(80, moves.size());
	}

	/**
	 * .x.
	 * xXx
	 * .x.
	 */
	public void testGroup1() {
		IBoard board = new GoBoard(9);
		AllMoveSelector moveSelector = new AllMoveSelector(new AtariGoRules());
		Collection<Move>	moves;
		
		board.setStone(1, 2, IBoard.BLACK_STONE);
		board.setStone(3, 2, IBoard.BLACK_STONE);
		board.setStone(2, 1, IBoard.BLACK_STONE);
		board.setStone(2, 3, IBoard.BLACK_STONE);
		moves = moveSelector.getCandidates(board, IBoard.BLACK_STONE);
		
		assertEquals(77, moves.size());
	}

	/**
	 * .x.
	 * xOx
	 * .x.
	 */
	public void testGroup2() {
		IBoard board = new GoBoard(9);
		AllMoveSelector moveSelector = new AllMoveSelector(new AtariGoRules());
		Collection<Move>	moves;
		
		board.setStone(1, 2, IBoard.BLACK_STONE);
		board.setStone(3, 2, IBoard.BLACK_STONE);
		board.setStone(2, 1, IBoard.BLACK_STONE);
		board.setStone(2, 3, IBoard.BLACK_STONE);
		moves = moveSelector.getCandidates(board, IBoard.WHITE_STONE);
		
		assertEquals(76, moves.size());
	}

}
